#include<iostream>
using namespace std;
int n;
int dp[110];
int sums[110][110][110];
int getMax(int arr[110], int n)
{
    int res = dp[0] = arr[0];
    for (int i = 1; i < n; ++i)
    {
        dp[i] = max(dp[i - 1], 0) + arr[i];
        res = max(res, dp[i]);
    }
    return res;
}
int main()
{
    int val;
    int ans = -0x3f3f3f;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cin >> val;
            for (int k = 0; k <= i; ++k)
                if (k == 0)
                    sums[i][k][j] = val;
                else
                    sums[i][k][j] = sums[i - 1][k - 1][j] + val;
        }
    }
    for (int i = 0; i < n; ++i)
        for (int k = 0; k <= i; ++k)
            ans = max(ans, getMax(sums[i][k], n));
    cout << ans;

    return 0;
}
